﻿using UnityEngine;
using System.Collections;

public class RandomImage : MonoBehaviour {
	public GameObject[] ImageCard;
	public Transform[] PosImage;
	 
	int index;
	int vitri;
	int temp=0;
	public static int sothe;

	ArrayList array=new ArrayList();
	void Start()
	{
		for(int i=0;i<=ImageCard.Length-1;i++)
		{
			array.Add(i);
		}
		sothe = ImageCard.Length / 2;
	}
	void Update()
	{
		if(Time.timeSinceLevelLoad>=.1f*temp &&temp<ImageCard.Length)
		{
		index = Random.Range (0,array.Count);
		vitri=	System.Convert.ToInt32(array[index]);
		Instantiate (ImageCard[vitri],PosImage[temp].position,Quaternion.Euler(0,180,0));
			array.RemoveAt(index);
		temp++;
		 }
	 }
}
